import { Input } from "@/core/Input.js";
import { config } from "@/managers/ConfigManager";
import { SceneManager } from "@/managers/SceneManager.js";
import { Scene_MenuBase } from "@/scenes/Scene_MenuBase.js";
import { Window_Status } from "@/windows/Window_Status.js";

export class Scene_Status extends Scene_MenuBase {
    constructor() {
        super();
    }

    create() {
        super.create();
        this._statusWindow = new Window_Status(config.width,config.height);
        this.addWindow(this._statusWindow);
    }

    start() {
        super.start();
        this.refreshActor();
    }

    update(){
        this.updateInput();
        super.update();
    }

    updateInput(){
        if(Input.isTriggered('escape')){
            SceneManager.pop();
        }else if(Input.isTriggered('pageup')){
            this.previousActor();
        }else if(Input.isTriggered('pagedown')){
            this.nextActor();
        }
    }

    refreshActor() {
        this._statusWindow.setActor(this.actor());
    }

    onActorChange() {
        this.refreshActor();
    }
}